package com.fowo.api.syncLingxingApi.service.syncImpl;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.fowo.api.syncLingxingApi.entity.TmpSyncLingxingToFbaList;
import com.fowo.api.syncLingxingApi.service.SyncLxApiBaseService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
@Slf4j
@DS("ds24")
public class SyncLxFbaListServiceImpl
        extends SyncLxApiBaseService<TmpSyncLingxingToFbaList, TmpSyncLingxingToFbaList> {
    private final static String LX_API_URL_KEY = "fbaListUrl";
    private final static int LX_API_MAX_LEN = 1000;

    public SyncLxFbaListServiceImpl() {
        super(LX_API_URL_KEY, LX_API_MAX_LEN);
    }

    @Override
    protected JSONObject pullLingxingData(long offset, long length, JSONObject params) {
        Map<String, Object> reqBody = new java.util.HashMap<>();

        if (offset > 0) reqBody.put("offset", offset);
        if (length > 0) reqBody.put("length", length);
        if (params != null) {
            if (params.containsKey("sid")) reqBody.put("sid", params.getString("sid"));
            return this.tryRequestLingxingApi(reqBody);
        }

        return null;
    }

    @Override
    protected boolean cmpNewAndOldEqualCond(TmpSyncLingxingToFbaList newOne, TmpSyncLingxingToFbaList oldOne) {
        return false;
    }

    @Override
    protected TmpSyncLingxingToFbaList cmpNewAndOldInsertProc(TmpSyncLingxingToFbaList newOne) {
        return null;
    }

    @Override
    protected TmpSyncLingxingToFbaList cmpNewAndOldUpdateProc(TmpSyncLingxingToFbaList newOne, TmpSyncLingxingToFbaList oldOne) {
        return null;
    }

    @Override
    protected boolean cmpNewAndOldUpdateCond(TmpSyncLingxingToFbaList newOne, TmpSyncLingxingToFbaList oldOne) {
        return false;
    }

    @Override
    protected void saveTempToFormal() {

    }

    @Override
    protected List<TmpSyncLingxingToFbaList> jsonDumpsResult(JSONArray jsonArray) {
        return null;
    }

    @Override
    protected List<TmpSyncLingxingToFbaList> getOldData(List<TmpSyncLingxingToFbaList> newObjects) {
        return null;
    }

    @Override
    protected void saveData2TmpTb(List<TmpSyncLingxingToFbaList> results) {

    }
}
